SELECT T.* FROM C1_DICTIONARY t
join C1_DICTIONARY_TYPE  t_DICTIONARY_TYPE on (t_DICTIONARY_TYPE.id = t.type_id)
where NOW() BETWEEN IFNULL(T.BEGIN_DATE, NOW()) AND IFNULL(T.END_DATE, NOW())
AND NOW() BETWEEN IFNULL(t_DICTIONARY_TYPE.BEGIN_DATE, NOW()) AND IFNULL(t_DICTIONARY_TYPE.END_DATE, NOW())
AND t_DICTIONARY_TYPE.ID = :typeId
order by t.ORDER_NUM